package Month09.day0919.part_1;

public class Test {
    public static void eat(Animal a){
        a.eat();

    }

    public static void main(String[] args) {
        Animal animal = new Animal("不知名动物",1,"公");
        Dog dog = new Dog("德牧",1,"公");
        Cat cat = new Cat("胖橘",1,"母");
        Animal animal1 = dog;
        Animal animal2 = cat;
        if(animal1 instanceof Dog){
            dog = (Dog)animal1;
            dog.dogEat();
        }

        if(animal1 instanceof Cat){
            cat = (Cat) animal1;
            cat.catEat();
        }

    }
}
